"""
# 提取有效的用户注册信息，格式：用户名,密码,昵称,真实姓名,手机号,所在城市，提取有效数据（即手机号和真实姓名不为空且手机号符合11位数）保存到数据库表中
zhangsan,zs00123,张先生,张三,17719283819,上海
zhanglaoer,zle00123,二爷,张老二,177192833819,山东
wangjianguo,zjg00123,专业谐音梗,王建国,19284338219,上海
xiaohuanxiong,xiaohx29@,呼兰,呼兰,17719283344,上海
lidan,lidan(,李诞,李诞,18208393201,山东
lixueqing,lxqyy993*,李MM,李雪琴,,山东
jianing,jianing28(,佳宁,佳宁,18200839201,山东
lidan,lidan(,李诞,李诞,18208393201,山东
"""

# 读取
text= open("userinfo.txt","r",encoding="utf-8")
text.readline()
tx=text.readlines()
text.close()

accounts=[]
passwords=[]
names=[]
realnames=[]
mobiles=[]
citys=[]

for i in tx:
    # print(i)
    a1=i.split('\n')
    a2=a1[0]
    a3=a2.split(',')
    print(a3)

    if len(a3)==6:
        accounts.append(a3[0])
        passwords.append(a3[1])
        names.append(a3[2])
        realnames.append(a3[3])
        mobiles.append(a3[4])
        citys.append(a3[5])
else:
    pass
print('___________________________________________')
print(accounts)
print(passwords)
print(names)
print(realnames)
print(mobiles)
print(citys)
print('___________________________________________')
class userinfo:
    def __init__(self,acc,psw,name,realname,mobile,city):
        self.acc=acc
        self.psw=psw
        self.name=name
        self.realname=realname
        self.city=city
        self.mobile = mobile
str=""
for n in range(len(accounts)):
    usr=userinfo(accounts[n],passwords[n],names[n],realnames[n],mobiles[n],citys[n])
    us = usr.acc+" "+usr.psw+" "+usr.name+" "+usr.realname+" "+usr.mobile+" "+usr.city
    # us1 =str+ us+"\n"
    print(us)
print(us)
